import { Controller, Get, Post, Body, Query } from '@nestjs/common';
import { MessageService } from './message.service';
import { CreateMessageDto } from './dto/create-message.dto';

import { RequrieLogin } from 'src/cu-dec';

@Controller('message')
@RequrieLogin()
export class MessageController {
  constructor(private readonly messageService: MessageService) {}

  @Post()
  create(@Body() createMessageDto: CreateMessageDto) {
    return this.messageService.create(createMessageDto);
  }

  @Get()
  findAll(@Query('roomId') roomId: number) {
    return this.messageService.findAll(roomId);
  }
}
